/*
题目链接:https://leetcode.cn/problems/minimum-number-of-operations-to-make-elements-in-array-distinct/description/?envType=daily-question&envId=2025-04-08
*/

//题解代码:
class Solution {
public:
    int minimumOperations(vector<int>& nums) {
        unordered_map<int,bool> ump;
        int n = nums.size();
        int i;
        for(i=n-1;i>=0;--i){
            if(ump.count(nums[i])) break;
            else{
                ump[nums[i]] = 1;
            }
        }
        return (i+1+2)/3;
    }
};
